interface Tools {
    double computerFee(double distance,int per,int tolls,int number);
    //计算运输费用
    //distance 元/公里
    //per 距离
    //tolls 过路费
    //number 乘客
}

abstract class Traffic {
    abstract String getName();
}

class Car extends Traffic implements Tools {
    double sum=0;
    @Override
    public double computerFee(double distance, int per, int tolls, int number) {
        this.sum=(per*distance)+tolls+number;
        return sum;
    }

    @Override
    public String getName() {
        return "Car"+" :"+sum;
    }
}

class Bus2 extends Traffic implements Tools {
    double sum;
    @Override
    public double computerFee(double distance, int per, int tolls, int number) {
        this.sum=(per*distance)+tolls+number*0.2;
        return sum;
    }

    @Override
    public String getName() {
        return "Bus"+" :"+sum;
    }
}

class ComputerFee {
    static void getFee(Tools T,double distance,int per,int tolls,int number) {
        T.computerFee(distance,per,tolls,number);
    }
}

public class Test_2 {
    public static void main(String[] args) {
        Car C = new Car();
        Bus2 B = new Bus2();

        C.computerFee(100,20,200,30);
        B.computerFee(200,10,300,40);

        System.out.println(C.getName());
        System.out.println(B.getName());
    }
}
